//
// Created by imed on 2024/4/15.
//

#include "RenderTools.h"

std::string RenderHtmlTemplate(std::string templatePath, std::map<std::string, std::string> &dict) {
    inja::json sampleJson;

    // copy
    for(const auto &dictPair: dict){
        sampleJson[dictPair.first] = dictPair.second;
    }

    // render
    inja::Environment env;
    inja::Template temp = env.parse_template(templatePath);
    std::string result = env.render(temp, sampleJson);

    return result;
}
